package org.rzp.ideaplug.statistic.setting;

import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@State(
        name = "org.rzp.ideaplug.statistic.setting.StatisticPushSettingState",
        storages = {@Storage("StatisticPushSetting.xml")}
)
public class StatisticPushSettingState implements PersistentStateComponent<StatisticPushSettingState> {

    public String user;

    public String url;

    public boolean open;

    public boolean close;


    public static StatisticPushSettingState getInstance() {
        return ServiceManager.getService(StatisticPushSettingState.class);
    }

    @Nullable
    @Override
    public StatisticPushSettingState getState() {
        return this;
    }

    @Override
    public void loadState(@NotNull StatisticPushSettingState state) {
        XmlSerializerUtil.copyBean(state, this);
    }
}
